
import java.util.Random;

public class Hero {

    private String name;
    private String [] skill;
    private int skillHurts [] ;
    private double hp;
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public String[] getSkill() {
        return skill;
    }
    public void setSkill(String[] skill) {
        this.skill = skill;
    }
    public int[] getSkillHurts() {
        return skillHurts;
    }
    public void setSkillHurts(int[] skillHurts) {
        this.skillHurts = skillHurts;
    }
    public double getHp() {
        return hp;
    }
    public void setHp(double hp) {
        this.hp = hp;
    }

    public Hero() {
        super();
    }

    public Hero(String name , String [] skill , int [] skillHurts , double hp) {
        this.name = name;
        this.skill = skill;
        this.skillHurts = skillHurts;
        this.hp = hp;
    }
    public void attack(Hero otherHero) {
        Random r= new Random();
        int skillnum = r.nextInt(skill.length);
        String skill = this.skill[skillnum];
        double skillhurt = this.skillHurts[skillnum];
        otherHero.hp = otherHero.hp-skillhurt;
        System.out.println(name+"使用了"+skill+"技能,对"+otherHero.getName()+"造成了"+skillhurt+"点伤害,"+otherHero.getName()+"现在还剩"+otherHero.hp+"点血量。");

    }
}
